#!/bin/bash 

#nohup node app.js &
cd `dirname $0`  
#当前路径  
BIN_DIR=`pwd`  
echo $BIN_DIR  
#nohup node $BIN_DIR/app.js &

APP_PID=`ps -ef -ww |egrep -v 'grep' | grep "$BIN_DIR" | awk '{print $2}'` 
#echo $APP_PID
#APP_PID不为空，说明应用已启动，直接退出  
if [ -n "$APP_PID" ]; then  
    echo "ERROR: The $SERVER_NAME already started!"  
    echo "PID: $APP_PID" 
    kill -9   $APP_PID
   # exit 1  
fi

nohup node $BIN_DIR/app.js &
